Date.prototype.format = function(format){
var o = {
"M+" : this.getMonth()+1, //month
"d+" : this.getDate(), //day
"h+" : this.getHours(), //hour
"m+" : this.getMinutes(), //minute
"s+" : this.getSeconds(), //second
"q+" : Math.floor((this.getMonth()+3)/3), //quarter
"S" : this.getMilliseconds() //millisecond
}

if(/(y+)/.test(format)) {
format = format.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
}

for(var k in o) {
if(new RegExp("("+ k +")").test(format)) {
format = format.replace(RegExp.$1, RegExp.$1.length==1 ? o[k] : ("00"+ o[k]).substr((""+ o[k]).length));
}
}
return format;
} 

var today = new Date()
var str = today.format("yyyy-MM-dd hh:mm:ss,S"); 
console.log(str)

var sqlite3 = require('sqlite3').verbose();
//var db = new sqlite3.Database(':memory:');
var db = new sqlite3.Database('haha.db');

db.serialize(function() {

    db.run('CREATE TABLE IF NOT EXISTS records (ip TEXT,time TEXT,url TEXT) ');
    var stmt = db.prepare('INSERT INTO records VALUES (?,?,?)');

    for (var i = 0; i < 10; i++) {
        stmt.run('Ip11.111.11. ' + i,str,"wwwww.qqq.com/asdd");
    }

    stmt.finalize();

    db.each('SELECT * FROM records', function(err, row) {
        console.log(row);
    });
});

db.close();
